feat(hooks): delete SessionEnd captureMemory session_checkpoint write (03-R1/06-M1)#80
Merged
Merged
Conversation
…ntent Plugin-side companions to the akm review-07 hardening. 07 P1-B (item 20): the SubagentStart hook injected the raw `akm workflow list --active` JSON into subagent context — including workflowTitle (verbatim from workflow frontmatter) and params (arbitrary user input), both attacker-influenceable. summarizeActiveWorkflows() now emits only run id + ref + status + current step, dropping title/params. 07 hardening (item 21): recalled/curated stash content is written to a file the agent reads (both the UserPromptSubmit prompt-recall and SessionStart paths). tagRecalledContent() prepends a provenance banner framing the block as reference DATA, not trusted instructions — the interim mitigation for the captureMemory injection surface that does NOT delete the write (that deletion stays deferred behind the minting-shutdown measurement gate). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv
…rite (03-R1/06-M1) The Claude plugin's SessionEnd `captureMemory()` path wrote a `session_checkpoint` memory via `akm remember … --force` on every Stop/SubagentStop/PreCompact — a below-every-improve-gate direct stash write (no judge/confidence/schema gate) that floods the stash with write-only telemetry. Meta-review 03-R1/06-M1 retires it. This is the akm-plugin half; the akm-side recombine exclusion filter is DEFERRED (load-bearing — it excludes all session-capture memories, not just checkpoints) and the update-stashes cron is a separate akm PR. Deleted (claude/hooks/akm-hook.ts): `captureMemory()` + its 3 call sites, the `capture-memory` CLI subcommand, helpers used only by it, and the now-dead Stop/SubagentStop/PreCompact hook registrations (their only command was `capture-memory …`). `akm index` on session-end survives — relocated into `sessionEnd()` under the same AKM_INDEX_ON_SESSION_END/akmAvailable gates. PRESERVED (verified by code-review): the memory-CANDIDATE pipeline (extractCandidatesFromText/appendCandidates/CANDIDATE_LOG → /akm-memory-promote), the `akm extract` SessionEnd path, and `tagRecalledContent` (the injection- hardening banner — NOT captureMemory-specific; wraps all recalled/curated content). Reviewer fixes applied: dropped the now-unused `redactObject` import; corrected the stale "harvest session memories at stop/compact time" README line. Tests: removed ~13 captureMemory/session_checkpoint tests; added 3 covering the relocated sessionEnd→index (runs index, respects opt-out, asserts no `remember`). Evals: the tier-2 `memory` metric replayed session logs through the now-deleted `capture-memory session-end`, so it's removed (metric + fixtures + diff policy rules + docs) and the checked-in baseline regenerated via `baseline:update` (5 metrics, no `memory`). Latency drift in the regen is harmless — latency is opt-in (`--include-latency`), not gated by default. Gate: `bun test tests/` 319/0; `tier2/runner.ts --baseline` exit 0 (no regression). Follow-ups (out of scope): opencode/index.ts has its own parallel session_checkpoint write (sibling plugin); the recombine filter + live crontab removal + build/reinstall (~beta.59) remain. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv
Contributor
Eval diff
Metric deltas
Plugin surfaceNo surface changes. No regressions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Meta-review minting-shutdown, akm-plugin half. Deletes the below-every-gate SessionEnd
captureMemory()write (akm remember --force,akm_memory_kind: session_checkpoint) that flooded the stash with write-only telemetry on every Stop/SubagentStop/PreCompact.Deleted:
captureMemory()+ 3 call sites, thecapture-memoryCLI subcommand, helpers used only by it, and the Stop/SubagentStop/PreCompact hook registrations (whose only command wascapture-memory …).akm indexon session-end survives — relocated intosessionEnd()under the same gates.Preserved (verified by code-review): the memory-CANDIDATE →
/akm-memory-promotepipeline, theakm extractSessionEnd path, andtagRecalledContent(injection-hardening banner — not captureMemory-specific).Evals: the tier-2
memorymetric replayed through the now-deletedcapture-memory, so it's removed and the baseline regenerated (baseline:update, 5 metrics). Latency drift is harmless (opt-in, not gated by default).Gate:
bun test tests/319/0;tier2/runner.ts --baselineexit 0.This branch also carries the unmerged batch-1 akm-plugin commit (
48f9345— SubagentStart injection hardening + recalled-content provenance tagging) which never got its own PR.Follow-ups (out of scope, tracked):
opencode/index.tshas its own parallel session_checkpoint write (sibling plugin); the akm-side recombineisSessionCaptureMemoryNamefilter deletion is DEFERRED (load-bearing); and the owner steps remain — remove the liveupdate-stashescrontab entry (paired akm PR #709) +bun run build/reinstall (~beta.59).🤖 Generated with Claude Code
https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv